package com.example.e

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Message
import android.view.Window
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity


class WelcomeActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        requestWindowFeature(Window.FEATURE_NO_TITLE)
        window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN)

        setContentView(R.layout.activity_welcome)

        val actionBar = supportActionBar

        actionBar?.hide()
        handler.sendEmptyMessageDelayed(0,3000)

    }
    private val handler: Handler = object : Handler() {
        override fun handleMessage(msg: Message) {
            getHome()
            super.handleMessage(msg)
        }
    } //消息处理对象,负责发送与处理消息


    fun getHome() {
        val intent = Intent(this@WelcomeActivity, MainActivity::class.java)
        startActivity(intent)
        finish()
    }


}